#pragma once
#include "../http/HttpRequest.h"
#include "../http/HttpResponse.h"
#include <memory>
namespace http
{
    namespace middleWare
    {
        class Middleware
        {
        public:
            virtual ~Middleware() = default;
            // 在请求处理之前执行
            virtual void before(const HttpRequest &req) = 0;
            // 在响应处理之后执行
            virtual void after(HttpResponse &resp) = 0;

            // 设置下一个中间件
            void setNext(std::shared_ptr<Middleware> next) { _nextMiddleware = next; }

        protected:
            std::shared_ptr<Middleware> _nextMiddleware;
        };
    } // namespace middleWare
} // namespace http